#include <iostream>
#include "sqlist.h"

using namespace std;

Status QuickSort(SqList &, int start=-1, int end=-2);

int main(void)
{
	SqList sql;
	sql.InitList();
	int num[10], i;
	for(i = 0; i <= 9; i++)
		cin >> num[i];
	for(i = 0; i <= 9; i++)
		sql.ListInsert(num[i]);
	QuickSort(sql);
	for(i = 1; i <= 10; i++)
		printf("%d ", sql.GetElem(i));
	return 0;
}

Status QuickSort(SqList &L, int start, int end)
{
	if(start == -1 && end == -2)
	{
		start = 0;
		end = L.length-1;
	}
	else if(start+1 >= end)
		return OK;
	printf("%d %d\n", start, end);
	int x = L.elem[(start+end)/2], i, j;
	ElemType t;
	i = start;
	j = end;
	while(i < j)
	{
		while(L.elem[i] < x)
			i++;
		while(L.elem[j] > x)
			j--;
		t = L.elem[i];
		L.elem[i] = L.elem[j];
		L.elem[j] = t;
	}
	// printf("%d %d %d %d\n", start, i, j, end);
	QuickSort(L, start, i);
	QuickSort(L, j, end);
	return OK;
}